FROM clux/muslrust:1.73.0 as build

# Set workdir to root
WORKDIR /
# Create sample project
RUN mkdir /rrai
# Make it the workdir
WORKDIR /rrai
# Copy over toml files
COPY Cargo.toml ./
COPY .cargo .cargo
COPY crates crates
COPY plugins plugins
COPY apps apps
COPY src src

# Build the whole thing
RUN cd apps/rrai-cli && cargo build --release

RUN mkdir -p move/rrai
RUN cp /rrai/target/x86_64-unknown-linux-musl/release/rrai-cli move/rrai/
RUN strip move/rrai/rrai-cli
RUN ls move/

FROM alpine
COPY --from=build /rrai/move /

WORKDIR /rrai
